Einhugur Word Plugin for Xojo

EinhugurWord.Drawing Class

Class representing drawings in the Word document.

Currently we only support reading drawings that are Images and or SVG.

Not Word art drawings.

Object
   Drawing

class EinhugurWord.Drawing

Constructors

Drawing (private) Private constructor.

Properties

AltTextDescriptionSets or gets description for Alt Text.
HasSVGRepresentationReturns true if the drawing has SVG representation.
IsPictureReturns true if the Drawing is Picture.
PictureDataReturns the raw data for the picture as String.
PictureFileNameGets name of the picture file.
PictureTypeReturns type of the picture.
SVGRepresentationDataReturns the raw data for the SVG as String.
SVGRepresentationFileNameGets name of the SVG file.

Examples

Embedding image from Xojo.

Note this example also needs Einhugur GraphicsFormats plugin and Einhugur TypeLib plugin.


using EinhugurWord

var ft as FileType = new FileType
ft.Extensions = "docx"
ft.Name = "Word Document"

var f as FolderItem = FolderItem.ShowSaveFileDialog(ft, "New document.docx")

if f <> nil then
    try
       var doc as Document = Document.Create(f)
      
       doc.Creator = "Einhugur test user"
       doc.LastModifiedBy = "Einhugur test user"
       doc.Subject = "My first"
      
       // Empty document has one paragraph so we just populate the first one instead of adding
       call doc.Paragraph(0).AppendRun("Hello world ! This is my first paragraph. Bellow we will add Xojo Picture")
      
       // Create some Xojo Picture object
       var pic as Picture = new Picture(450,450)
       var g as Graphics = pic.Graphics
      
       g.DrawingColor = &C800000
       g.FillRectangle(1,1, 200, 200)
      
       g.DrawingColor = &C0000FF
       g.FillRectangle(150,150, 200, 200)
      
       var exporter as RawPngExporter = new RawPngExporter()
       var imageData as String = exporter.SaveToString(RawBitmapConverter.FromPicture(pic))
      
       call doc.AppendParagraph(imageData, EinhugurWord.PictureTypes.png, "My image from Xojo", pic.Width, pic.Height)
      
       doc.Save()
      
    catch e as WordException
    MessageBox e.Message
end try
end if

Supported Platforms:

  • macOS Intel 64 bit
  • macOS Apple Silicon
  • Windows 32 bit
  • Windows 64 bit
  • Windows ARM 64 bit
  • Linux 32 bit
  • Linux 64 bit
  • Linux ARM 32 bit
  • Linux ARM 64 bit
  • iOS